package com.lds.erp.configuration;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;


/**
 * @author hongsir
 * @apiNote 线程池配置
 * ps:CorePoolSize属性一定要大于1
 * @date 2018/9/18 下午1:57
 */
@Configuration
public class ThreadPoolConfiguration {
    @Bean
    public ThreadPoolTaskExecutor taskExecutor() {
        ThreadPoolTaskExecutor threadPool = new ThreadPoolTaskExecutor();
        threadPool.setCorePoolSize(10);
        threadPool.setMaxPoolSize(10);
        threadPool.setDaemon(true);
        threadPool.setQueueCapacity(10);
        return threadPool;
    }

}
